package com.fqgj.xjd.user.client.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: cashmama-user
 * @description
 * @author: frank
 * @create: 2020-04-22 17:30
 **/
public enum UserIndustryEnum {

    ANIMAL_HUSBANDRY(1, "Animal Husbandry", true),
    FISHERY(2, "Fishery", true),
    TRANSPORT_LOGISTICS(3, "Transport and Logistics", true),
    TOURISM(4, "Tourism", true),
    AGRICULTURE(5, "Agriculture", true),
    E_COMMERCE(6, "E-commerce", true),
    HOTELS(7, "Hotels", true),
    USED_CAR_INDUSTRY(8, "Used-car industry", true),
    SERVICES_WORKSHOP(9, "Services/workshop", true),
    AUTOMOBILE(10, "Automobile", true),
    CATERING(11, "Catering", true),
    CHEMIST_DRUGGIST(12, "Chemist/druggist", true),
    MEDIA(13, "Media", true),
    CONSULTING(14, "Consulting", true),
    ELECTRICALS_ELECTRONICS(15, "Electricals and Electronics", true),
    FASHION_APPAREL(16, "Fashion/Apparel", true),
    FMCQ(17, "FMCQ", true),
    GROCERY_STORE(18, "Grocery Store", true),
    HEALTHCARE(19, "Healthcare", true),
    JEWELLERY(20, "Jewellery", true),
    METALS(21, "Metals", true),
    PHARMACEUTICALS(22, "Pharmaceuticals", true),
    REAL_ESTATE(23, "Real Estate", true),
    ENTERTAINMENT(24, "Entertainment", true),
    OTHERS(25, "Others", true);

    UserIndustryEnum(Integer code, String desc, boolean display) {
        this.code = code;
        this.desc = desc;
        this.display = display;
    }

    private Integer code;
    private String desc;
    /**
     * 是否显示
     */
    private boolean display;

    public Integer getCode() {
        return code;
    }

    public UserIndustryEnum setCode(Integer code) {
        this.code = code;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public UserIndustryEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public boolean isDisplay() {
        return display;
    }

    public UserIndustryEnum setDisplay(boolean display) {
        this.display = display;
        return this;
    }

    public static UserIndustryEnum getEnumByType(Integer type) {
        UserIndustryEnum userCareerEnum = null;
        for (UserIndustryEnum enumObj : UserIndustryEnum.values()) {
            if (enumObj.getCode().equals(type)) {
                userCareerEnum = enumObj;
                break;
            }
        }
        return userCareerEnum;
    }

    public static UserIndustryEnum getEnumByDesc(String desc) {
        UserIndustryEnum userCareerEnum = null;
        for (UserIndustryEnum enumObj : UserIndustryEnum.values()) {
            if (enumObj.getDesc().equals(desc)) {
                userCareerEnum = enumObj;
                break;
            }
        }
        return userCareerEnum;
    }

    public static List<String> getDescList() {
        List<String> list = new ArrayList<>();
        for (UserIndustryEnum enumObj : UserIndustryEnum.values()) {
            if(enumObj.isDisplay()) {
                list.add(enumObj.getDesc());
            }
        }
        return list;
    }
}
